home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
packet
/
p_tapr
/
tnchst
/
blp.inc
< prev
next >
Wrap
Text File
|
1991-01-01
|
3KB
|
145 lines
#ifndef BLP_INCLUDES
#define BLP_INCLUDES
#define NLINKS 50
/* storage for BLPCB's is allocated statically */
#define BLP_RETRY_TIME 30
/* retry time in seconds - must be 0<=x<=32767 */
#define BLP_MAX_TRIES 10
#define BLP_MAX_OUTSTANDING 15
#define BLPDATASIZE 256 /* max size of data fields */
#define ADDRSIZE 9*7
/* if loopback 1 then all outgoing lcns are XOR'd with 0xC0 */
#define LOOPBACK 0
#define BLP_EVENT_TRACE FALSE
/* tnc will send broadcast packets on this channel */
#define BROADCAST_LCN 0x71
/* BLP command codes */
#define CS 0x02
#define CSEMAIL 0x12 /* special only */
#define CCC 0x04
#define CCLR 0x08
#define CCLRD 0x09
#define CSTENQ 0x10
#define CSTREP 0x11
#define UDATA 0x20
#define DDATA 0x80
#define DACK 0x90
#define DBUSY 0xA0
struct bframe_struct { /* structure of blp frames */
/* byte dest;
byte source; /* dest, source are optional */
byte lcn ; /* logical channel */
byte cmd ; /* command */
byte data[ BLPDATASIZE ] ; /* data field */
};
struct datapacket_struct { /* structure holding pktzd tx data*/
word len ; /* for linked list */
struct datapacket_struct *next ; /* linked list - next pkt */
byte data[ BLPDATASIZE ] ;
};
/* structure controls all aspects of a particular BLP interface,
specifically BLP for .lcn */
struct blpcb_struct {
byte lcn ; /* lcn for this link */
byte local_chan ; /* upper level's token for this link */
byte address[ ADDRSIZE ]; /* upper level called address */
byte bsstate, bdstate ; /* sup'vy and data state variables */
byte bdtxseq, bdrxseq ; /* sequence #'s */
struct datapacket_struct txpackets ; /* head node of lkd list of pkts */
/* bit wasteful */
byte outstanding ; /* # of outstanding pkts in linked lst*/
byte retry_count ;
int timer ; /* (-1) = stopped, 0 = expired,
anything else means running */
byte email ; /* true if outgg call is for email port */
};
/* structure used by state tables */
struct state_entry {
/* handler for the state */
void (*action_handler) (struct blpcb_struct *,
struct bframe_struct *, word );
byte newstate ; /* new state */
};
/**** states
Note that states must start at state 1! ****/
#define NSSTATES 7
#define NSEVENTS 11
#define NDSTATES 4
#define NDEVENTS 8
/* Supervisory states */
#define BSIDLE 1
#define BSLCSETUP 2
#define BSRCSETUP 3
#define BSLSETWT 4
#define BSRSETWT 5
#define BSCLEARWT 6
#define BSDATA 7
/* data states */
#define BDIDLE 1
#define BDWAIT 2
#define BDBSY 3
#define BDBSYWT 4
/** events **/
/** received supervisory packets **/
#define RCVD_CS 0
#define RCVD_CA 1
#define RCVD_CCC 2
#define RCVD_CCCACK 3
#define RCVD_CCLR 4
#define RCVD_CCLRD 5
/** local events **/
#define LSTART 6
#define LSTOP 7
#define LCNCTD 8
#define LRETRY 9
#define LSTIMER 10
/** data events **/
#define LNEWDATA 20
#define LBLPACK 21
#define LDTIMER 22
#define LDATABUSY 23
#define LRXDATA 24
#define LRXACK 25
#define LUNBUSY 26
#define LRXCSTENQ 27
#define FIRST_DATA_EVENT LNEWDATA
#endif